package com.simon.nvwo;

import com.google.gson.Gson;
import io.searchbox.indices.CreateIndex;
import org.junit.Test;

import static junit.framework.TestCase.assertEquals;

/**
 * ES测试
 *
 * @author zhaoyiwu
 * @create 2018-02-24 9:45
 **/
public class ElasticSearch {

    @Test
    public void createIndexWithoutSettings() {
        CreateIndex createIndex = new CreateIndex.Builder("tweet").build();

        assertEquals("tweet", createIndex.getURI());
        assertEquals("PUT", createIndex.getRestMethodName());
        String settings = new Gson().toJson(createIndex.getData(new Gson()));
        assertEquals("\"{}\"", settings);
    }

}
